//
//  HotListCell.m
//  project
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 lanou. All rights reserved.
//

#import "HotListCell.h"
#import <UIImageView+WebCache.h>

@implementation HotListCell

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        self.contentView.backgroundColor = [UIColor whiteColor];
        CGFloat item = (kWidth - 30)/2;
        _imgView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, item, item)];
        //_imgView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_imgView];
                                                            
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, item + 5, item - 20, 40)];
       // _titleLabel.backgroundColor = [UIColor grayColor];
        _titleLabel.numberOfLines = 0;
        _titleLabel.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:_titleLabel];
        
        _priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, item + 50, (item - 20)/2, 20)];
       // _priceLabel.backgroundColor = [UIColor greenColor];
        _priceLabel.font = [UIFont systemFontOfSize:12];
        _priceLabel.textColor = [UIColor magentaColor];
        [self.contentView addSubview:_priceLabel];
        
        UIImageView *likeImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"like"]];
        likeImg.frame = CGRectMake(item - 80, item + 50, 20, 20);
        [self.contentView addSubview:likeImg];
        
        _likeLabel = [[UILabel alloc]initWithFrame:CGRectMake(item - 60, item + 50, 40, 20)];
      //  _likeLabel.backgroundColor = [UIColor greenColor];
        _likeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_likeLabel];
        
    }
    return self;
}

-(void)ConfigModel:(ListModel *)model
{

    [_imgView sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url]];
    
    _titleLabel.text = model.name;
    _likeLabel.text = [NSString stringWithFormat:@"%@", model.favorites_count];
    _priceLabel.text = [NSString stringWithFormat:@"￥%@", model.price];
}



@end
